import { createRouter, createWebHistory } from "vue-router";
//引入组件
import Login from "../views/login/login.vue";
import Labor from "@/views/labor/labor.vue";
import laborHome from "@/views/labor/laborHome.vue";
import Student from "@/views/student/student.vue";
import stundentHome from "@/views/student/stundentHome.vue";
import Institute from "@/views/institute/institute.vue";
import InstituteHome from "@/views/institute/instituteHome.vue";

//创建组件
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL), //路由工作模式
    routes: [
        {
            path: "/",
            redirect: "/login",
        },
        {
            path: "/login",
            name: "login",
            component: Login,
        },
        {
            path: "/register",
            name: "register",
            component: () => import("@/views/login/register.vue"),
        },
        {
            path: "/labor",
            name: "labor",
            component: Labor,
            children: [
                {
                    path: "home",
                    name: "laborHome",
                    component: laborHome,
                },
                {
                    path: "job",
                    name: "laborJob",
                    component: () => import("@/views/labor/job.vue"),
                },
                {
                    path: "set",
                    name: "laborSet",
                    component: () => import("@/views/labor/setting.vue"),
                },
                {
                    path:"announcement",
                    name:"laborAnnouncement",
                    component:()=>import("@/views/labor/labor_announcement.vue"),
                },
                {
                    path:"OwnPerson",
                    name:"laborOwnPerson",
                    component:()=>import("@/views/labor/laborOwnPerson.vue"),
                },
            ],
        },
        {
            path: "/studnet",
            name: "student",
            component: Student,
            children: [
                {
                    path: "home",
                    name: "studentHome",
                    component: stundentHome,
                },
                {
                    path: "work",
                    name: "studentWork",
                    component: () => import("@/views/student/work.vue"),
                },
                {
                    path: "receive",
                    name: "studentReceive",
                    component: () => import("@/views/student/receive.vue"),
                },
                {
                    path: "announcement",
                    name: "studentAnnouncement",
                    component: () => import("@/views/student/student_announement.vue"),
                },
                {
                    path: "ownPerson",
                    name: "studentOwnPerson",
                    component: () => import("@/views/student/studentOwnPerson.vue"),
                },
            ],
        },
        {
            path: "/institute",
            name: "institute",
            component: Institute,
            children: [
                {
                    path: "home",
                    name: "instituteHome",
                    component: InstituteHome,
                },
                {
                    path: "job",
                    name: "instituteJob",
                    component: () =>
                        import("@/views/institute/inistituteJob.vue"),
                },
                {
                    path:"announcement",
                    name:"instituteAnnouncement",
                    component:()=>import("@/views/institute/institute_announcement.vue"),
                },
                {
                    path:"report",
                    name:"instituteReport",
                    component:()=>import("@/views/institute/institueReport.vue"),
                },
                {
                    path:"ownPerson",
                    name:"instituteOwnPerson",
                    component:()=>import("@/views/institute/instituteOwnPerson.vue"),
                },
                {
                    path:"registerUser",
                    name:"instituteRegisterUser",
                    component:()=>import("@/views/institute/instituteRegisterUser.vue"),
                }
            ],
        },
        {
            path: "/division",
            name: "division",
            component: () => import("@/views/stu_division/division.vue"),
            children: [
                {
                    path: "home",
                    name: "divisionHome",
                    component: () =>
                        import("@/views/stu_division/divisionHome.vue"),
                },
            ],
        },
        {
            path:"/common/:workId",
            name:"Common",
            component:()=>import("@/views/common/CommentPage.vue"),
            props:true,
        },
        {
            path:"/laberJobTaker",
            name:"laberJobTaker",
            component:()=>import("@/views/labor/Job_taker.vue"),
        },
        
    ],
});

//暴露出路由
export default router;
